function JQuery() {
	this.ajax = function(options) {
		if (typeof (options) != "object")
			return false;
		this.dataType = options.dataType ? options.dataType : "text/html";
		this.type = options.type ? options.type : "get";
		this.data = options.data ? options.data : {};
		this.async = options.async ? options.async : false;
		this.url = options.url;
		this.user = options.user;
		this.password = options.password;
		this.xhr=getXmlHttpRequest();
		function stateChange() {
			if (xhr.readyState == 4) {
				if (xhr.status == 200) {
					//alert(success(xhr.responseText));
				} else {
					return error(x);
				}
			}
		}
		this.success = function(data) {
			options.success || {};
			return data;
		}
		this.error = function(xhr, status, t) {
			options.error || {};
			return {
				'xmlHttpRequest' : this.xhr,
				'status' : status,
				'throwable' : t
			}
		}
		this.onreadystatechange = function() {
			this.xhr.onreadystatechange = stateChange;
		}
		this.open = function() {
			this.xhr.open(this.type, this.url, this.async, this.user, this.password);
		}
		this.send = function() {
			this.xhr.send(this.data);
		}
		this.open();
		this.send();
	}
}
function getXmlHttpRequest() {
	var xhr = null;
	try {
		if (window.XMLHttpRequest) {
			xhr = new XMLHttpRequest();
			console.log(xhr.overrideMimeType);
			if (xhr.overrideMimeType) {
				xhr.overrideMimeType('text/xml');
			}
		} else if (window.ActiveXObject) {
			for ( var i = 5; i; i--) {
				try {
					if (i == 2) {
						xhr = new ActiveXObject("Microsoft.XMLHTTP");
					} else {
						xhr = new ActiveXObject("Msxml2.XMLHTTP." + i + ".0");
						xhr.setRequestHeader("Content-Type", "text/xml");
						xhr.setRequestHeader("Charset", "UTF-8");
						break;
					}
				} catch (e) {
					xhr = false;
				}
			}
		}
	} catch (e) {
		xhr = false;
	}	
	return xhr;
}
(function(window) {	
	var jQuery = window.$ = new JQuery();
	console.log(jQuery);

})(window);
